package etxt2db.minorthird;
import java.util.Iterator;
import java.util.List;

import edu.cmu.minorthird.text.Span;
import edu.cmu.minorthird.text.TextLabels;


public class MultiClassTextLabelsAnnotatorTeacher extends
		MultiClassAnnotatorTeacher {

	private TextLabels labels;

	private List<String> userLabelTypes;

	public MultiClassTextLabelsAnnotatorTeacher(TextLabels labels,List<String> userLabelTypes){
		this.labels=labels;
		this.userLabelTypes=userLabelTypes;
	}

	public Iterator<Span> documentPool(){
		return labels.getTextBase().documentSpanIterator();
	}

	public MultiClassAnnotationExample labelInstance(Span query){
		if(query.documentSpanStartIndex()!=0||
				query.size()!=query.documentSpan().size()){
			throw new IllegalArgumentException("can't label a partial document");
		}
		// should really generate a restricted view of this labels, containing just
		// one document...
		MultiClassAnnotationExample example=
				new MultiClassAnnotationExample(query,labels,userLabelTypes);
		return example;
	}

	public boolean hasAnswers(){
		return true;
	}

	public TextLabels availableLabels(){
		return labels;
	}
}
